<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
    <title>每日流水</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <!-- load css -->
    <link rel="stylesheet" th:href="@{/css/font.css}" />
	<link rel="stylesheet" th:href="@{/css/xadmin.css}" />
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
</head>
<body class="layui-anim layui-anim-fadein">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a>交易管理</a>
        <a><cite>每日流水</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <table class="layui-hide" id="table1" lay-filter="tool1"></table>
     </div>
<script type="text/html" id="succrateTpl">
{{# 
if(d.all_count==0)
{
return ''
}
else
{
return  (d.success_count/d.all_count*100).toFixed(2) + '%'  
}
}}
</script>
<script>
      layui.use(['laydate', 'laypage', 'table'], function(){
        var laydate = layui.laydate,
        table = layui.table, //表格
        laypage = layui.laypage; //分页
        //执行一个 table 实例
        table.render({
          elem: '#table1'
          ,height: 680
          ,limit: 15
          ,limits:[15,20,30,40,50,60,70,80,90]
          ,url: '[[@{/merchant/order/dayFinanceList.html}]]' //数据接口
          ,id:'table1'
          ,page: true
          ,cols: [
           [
            {field: 'time', title: '日期', width:'16%', sort: true, align:'center',fixed: 'left'}
            ,{field: 'all_amount', title: '订单总金额', width:'16%', align:'center'}
            ,{field: 'success_amount', title: '成功总金额', width:'16%', align:'center'}
            ,{field: 'all_count', title: '总订单数', width:'16%', align:'center'}
            ,{field: 'success_count', title: '成功订单数', width:'16%', align:'center'}
            ,{field: 'succrate', title: '成功率', width:'19%', align:'center',templet:'#succrateTpl'}
          ]
          ]
        });
        $('#searchBtn').on('click', function(){
        	var index = layer.msg('查询中，请稍候...',{icon: 16,time:false,shade:0});
        	table.reload('table1', {
    	        page: {
    	          curr: 1 //重新从第 1 页开始
    	        }
    	        ,where: {
    	        	'id': $('#id').val(),
    	        	'timeStr': $('#timeStr').val()
    	        }
    	      });
        	layer.close(index);
       });
        
      //监听工具条
        table.on('tool(tool1)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
          var data = obj.data //获得当前行数据
          ,layEvent = obj.event; //获得 lay-event 对应的值
          if(layEvent === 'detail'){
            //alert(JSON.stringify(data));
          } else if(layEvent === 'edit'){
          } else if(layEvent === 'del'){
          }
        });
      });
    </script>
  </body>
</html>
